package cn.haut.online_read.enrity;

import lombok.Data;
import lombok.ToString;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xing
 * @date 2021-05-13 18:27
 */
@Data
@ToString
public class BookInfo {
    String id;
    String name;
    String author;
    String desc;
    String imgUrl;
    String keep;
    String popularity;

    public BookInfo(String id, String name, String author, String desc, String imgUrl, String keep, String popularity) {
        this.id = id;
        this.name = name;
        this.author = author;
        this.desc = desc;
        this.imgUrl = imgUrl;
        this.keep = keep;
        this.popularity = popularity;
    }

    public static List<BookInfo> getBookInfoList(
            List<String> idList,
            List<String> nameList,
            List<String> authorList,
            List<String> descList,
            List<String> imgUrlList,
            List<String> keepList,
            List<String> popularityList
    ) {
        // 没有对 如果 每个 list 长度不一样的 处理
        List<BookInfo> bookInfoList = new ArrayList<>();
        for (int i = 0; i < idList.size(); i++) {
            bookInfoList.add(
                    new BookInfo(
                            idList.get(i),
                            nameList.get(i),
                            authorList.get(i),
                            descList.get(i),
                            imgUrlList.get(i),
                            keepList.get(i),
                            popularityList.get(i)
                    )
            );
        }
        return bookInfoList;
    }
}

